/**
 * User 业务逻辑实现类
 * @author yanwl
 * @date 2015-03-20
 */
package com.yyy.yyyclub.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yyy.yyyclub.core.common.DaoHelper;
import com.yyy.yyyclub.model.pojo.User;
import com.yyy.yyyclub.service.UserService;


@Service
@Transactional
public class UserServiceImpl  implements UserService {

	//声明工作空间
	private final static String nameSpace = "com.yyy.yyyclub.mapper.UserMapper";
		
	@Override
	public boolean insertUser(User user) {
		return DaoHelper.insert(nameSpace, "insertUser", user);
	}

	@Override
	public boolean updateUser(User user) {
		DaoHelper.update(nameSpace, "updateUser", user);
		
		User entity = new User();
		entity.setUserEmail("745214429@qq.com");
		entity.setUserName("龙哥");
		entity.setUserPassword("000000");
//		entity.setRemark("");
		return insertUser(entity);
	}

	@Override
	public User selectUser(Integer userId) {
		return (User) DaoHelper.query(nameSpace, "selectUser", userId);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<User> selectAllUsers() {
		return (List<User>)DaoHelper.list(nameSpace, "selectAllUsers", "");
	}

	@Override
	public boolean deleteUser(Integer userId) {
		return DaoHelper.delete(nameSpace, "deleteUser", userId);
	}
}
